package com.rc.saas.tenant.service.acct;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.rc.saas.tenant.mapper.acct.AcctBankMapper;
import com.rc.saas.tenant.model.acct.AcctBank;
import com.rc.saas.tenant.model.acct.AcctBankExample;
import com.rc.saas.tenant.search.acct.AcctBankSearch;
import com.rc.saas.tenant.vo.acct.AcctBankResultVo;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author frog
 * @date 2021/1/12
 */
@Service
public class AcctBankServiceImpl implements AcctBankService {

    @Autowired
    private AcctBankMapper acctBankMapper;

    @Override
    public AcctBankMapper getMapper() {
        return acctBankMapper;
    }

    @Override
    public PageInfo<AcctBankResultVo> listPageAcctBank(AcctBankSearch acctBankSearch) {
        PageHelper.startPage(acctBankSearch.getOffset(), acctBankSearch.getLimit());
        List<AcctBankResultVo> list = acctBankMapper.listPageAcctBank(acctBankSearch);
        return new PageInfo<AcctBankResultVo>(list);
    }

    @Override
    public List<AcctBank> selectByTenantOperatorCode(String tenantOperatorCode) {
        AcctBankExample example = new AcctBankExample();
        example.createCriteria().andTenantOperatorCodeEqualTo(tenantOperatorCode);
        List<AcctBank> acctBanks = acctBankMapper.selectByExample(example);
        return acctBanks;
    }
}
